package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.BusinessCardRequest;
import one.stand.request.CallsPhoneRecordRequest;
import one.stand.request.TokenRequest;
import one.stand.response.BusinessCardResponse;
import one.stand.response.GetCompanyStaffResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("crmPc/businessCard")
@Api(description = "成员管理",tags="PC-成员管理")
public class BusinessCardController extends BaseController {

    @ApiOperation(value = "审核名片")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "名片ID", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "auditState", value = "审核状态(0待审核，1审核通过，2拒绝)", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "auditRemark", value = "审核备注", paramType = "String"),
    })
    @PostMapping("auditBusinessCard")
    @ApiController(isLogin = true, company = true, card = true, isBoss = true,paramClass = BusinessCardRequest.class)
    public ResultModel auditBusinessCard(@RequestAttribute BusinessCardRequest request) {

        return crmFegin.auditBusinessCard(request);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "name", value = "员工姓名", paramType = "Integer"),
    })
    @ApiOperation(value = "获取员工名片列表")
    @PostMapping("getList")
    @ApiController(isLogin = true, company = true, card = true,paramClass = BusinessCardRequest.class)
    public ResultModel<List<BusinessCardResponse>> getList(@RequestAttribute BusinessCardRequest request) {
        
        return crmFegin.getList(request);
    }

    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "员工名片ID", paramType = "Integer"),
    })
    @ApiOperation(value = "获取员工详细信息")
    @PostMapping("getCompanyUserInfo")
    @ApiController(isLogin = true, company = true, card = true,paramClass = BusinessCardRequest.class)
    public ResultModel<List<BusinessCardResponse>> getCompanyUserInfo(@RequestAttribute BusinessCardRequest request) {
        
        return crmFegin.getCompanyUserInfo(request);
    }

    @ApiOperation(value = "获取公司员工")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "pageNum", value = "当前页", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "name", value = "名称和电话筛选", paramType = "String"),
    })
    @PostMapping("getCompanyStaffList")
    @ApiController(isLogin = true, company = true, card = true,paramClass = BusinessCardRequest.class)
    public ResultModel<Map<String, Object>> getCompanyStaffList(@RequestAttribute BusinessCardRequest request) {
        
        return crmFegin.getCompanyStaffList(request);
    }

    @ApiOperation(value = "得到公司员工信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "员工id", required = true, paramType = "Integer"),
    })
    @PostMapping("getCompanyStaffInfo")
    @ApiController(isLogin = true, company = true, card = true,paramClass = BusinessCardRequest.class)
    public ResultModel<GetCompanyStaffResponse> getCompanyStaffInfo(@RequestAttribute BusinessCardRequest request) {

        return crmFegin.getCompanyStaffInfo(request);
    }

    @PostMapping("quitCompany")
    @ApiOperation(value = "企业员工退出企业")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "cardId", value = "退出员工名片id", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "userId", value = "退出员工userId", required = true, paramType = "Integer"),
    })
    @ApiController(isLogin = true, company = true, card = true,paramClass = BusinessCardRequest.class)
    public ResultModel quitCompany(@RequestAttribute BusinessCardRequest request) {
        return crmFegin.quitCompany(request);
    }
}
